<?
	include_once(dirname(__FILE__).'/../../bootstrap/unit.php');
	include_once('bootstrap.php');
	
	$manager = bjPluginManager::getInstance();
	$f = new fileImageStorage();

	$descriptors = $f->getPluginDescriptors();
	
	//Erase the plugin def for the plugin if it exists
	$q = Doctrine_Query::create()
		->delete("bjPlugin")
		->addwhere("guid = ?", $descriptors["guid"])
		->execute();	

	$result = $manager->register($f);

   	$t->cmp_ok($result["errorCode"], '>', '0', 'Tests that the '.$descriptors["guid"].' plugin was saved to the database.');

	//Check that the plugin does not already exist
	$q = Doctrine_Query::create()
		->from("bjPlugin p")
		->where("p.guid = ?", $f->pluginDescriptors["guid"])
		->setHydrationMode(Doctrine::HYDRATE_ARRAY)
		->fetchOne();	
	
	$t->isnt($q["guid"], null, 'Tests that the '.$descriptors["guid"].' plugin is registered in the database.');
		
?>